<template>
  <div class="div-box">
    <el-row>
      <el-col :span="24">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="全部" name="all">
            <div style="margin: 50px;">
              <el-row :gutter="10">
                <el-col :span="8">
                  <el-card class="box-card">
                    <!-- 垂直居中-->
                    <div style="height: 100%;width: 100%; display: flex;justify-content: center;  align-items: center;">
                      <el-button type="text" @click="openAdd">
                        <i class="el-icon-circle-plus-outline" style="font-size: 70px;" />
                      </el-button>
                    </div>
                  </el-card>
                </el-col>
                <el-col :span="8">
                  <el-card class="box-card">
                    <div slot="header" class="clearfix">
                      <el-row :gutter="5">
                        <el-col :span="8">
                          <img
                            src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
                            class="image"
                          >
                        </el-col>
                        <el-col :span="16">
                          <span style="font-size: 20px;">活动标题</span>
                          <el-button style="float: right; padding: 3px 0" type="text">未发布</el-button>
                        </el-col>
                      </el-row>
                    </div>
                    <div style="padding-left: 10px;padding-top: 10px;">
                      <div class="item">
                        <span class="text">结束时间：</span>
                        <span class="text">2019-04-01 00:00:00 </span>
                      </div>
                      <div class="item">
                        <span class="text">参与人数：</span>
                        <span class="text">50</span>
                      </div>
                      <div class="item">
                        <span class="text">奖品情况：</span>
                        <span class="text">无</span>
                      </div>
                      <div class="item">
                        <span class="text">智能防刷：</span>
                        <span class="text">未开启</span>
                      </div>
                    </div>
                    <div class="bottom clearfix">
                      <el-row>
                        <el-col :span="6">
                          <i class="el-icon-s-promotion" style="font-size: 18px;">发布</i>
                        </el-col>
                        <el-col :span="6">
                          <i class="el-icon-edit" style="font-size: 18px;">编辑</i>
                        </el-col>
                        <el-col :span="6">
                          <i class="el-icon-view" style="font-size: 18px;">预览</i>
                        </el-col>
                        <el-col :span="6">
                          <el-dropdown trigger="click" @command="handleCommand">
                            <i class="el-icon-more" style="font-size: 18px;" />
                            <el-dropdown-menu slot="dropdown">
                              <el-dropdown-item command="userRecord">用户记录</el-dropdown-item>
                            </el-dropdown-menu>
                          </el-dropdown>

                        </el-col>
                      </el-row>
                    </div>
                  </el-card>
                </el-col>
              </el-row>
            </div>
          </el-tab-pane>
          <el-tab-pane label="未发布" name="second">未发布</el-tab-pane>
          <el-tab-pane label="未开始" name="third">未开始</el-tab-pane>
          <el-tab-pane label="进行中" name="fourth">进行中</el-tab-pane>
          <el-tab-pane label="已结束" name="fiveth">已结束</el-tab-pane>
        </el-tabs>
      </el-col>
    </el-row>
    <el-dialog
      title="添加活动"
      :visible.sync="taskAddVisible"
      width="100%"
      height="100%"
      :before-close="handleClose"
      overflow-y="scroll"
    >
      <el-row>
        <el-col :span="24">
          <el-button type="primary" @click="addTask">保存</el-button>
          <el-input v-model="taskData.id" style="display: none;" />

        </el-col>
      </el-row>
      <el-row>
        <!-- 左侧选项卡-->
        <el-col :span="8">
          <el-tabs :tab-position="tabPosition" style="height: 100%;">
            <el-tab-pane label="首页">
              <div>
                <div class="phoneWarp">
                  <div class="phoneBox">
                    <div class="phone">
                      <div class="wxTitle" style="text-align:center;">
                        <span style="font-size:16px;">有奖答题活动</span>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="活动过程">
              活动过程
            </el-tab-pane>
            <el-tab-pane label="答案解析">答案解析</el-tab-pane>
            <el-tab-pane label="挑战成功">挑战成功</el-tab-pane>
            <el-tab-pane label="分享效果">分享效果</el-tab-pane>
          </el-tabs>
        </el-col>
        <!--左侧选项卡结束-->
        <!-- 右侧设置开始-->
        <el-col :span="16">
          <el-form ref="taskData" :model="taskData">
            <div class="div-box">
              <el-tabs type="border-card">
                <el-tab-pane label="基础设置">
                  <span>基本选项</span>
                  <el-divider />
                  <el-form label-width="80px">
                    <el-form-item label="活动标题">
                      <el-input v-model="taskData.title" placeholder="请输入活动标题" />
                    </el-form-item>
                    <el-form-item label="活动时间">
                      <el-col :span="11">
                        <el-date-picker
                          v-model="tasktime"
                          type="daterange"
                          range-separator="至"
                          start-placeholder="开始日期"
                          end-placeholder="结束日期"
                        />
                      </el-col>
                    </el-form-item>
                    <el-form-item label="活动说明">
                      <div id="app">
                        <ckeditor v-model="editorData" :editor="editor" :config="editorConfig" />
                      </div>
                    </el-form-item>
                  </el-form>
                  <el-collapse v-model="activeNames" @change="handleChange">
                    <el-collapse-item title="参与条件" name="1">
                      <el-form label-width="200px">
                        <el-form-item label="参与人数限制">
                          <el-radio v-model="taskData.joinInType" label="0">不限</el-radio>
                          <el-radio v-model="taskData.joinInType" label="2">限制</el-radio>
                          <el-input
                            v-if="taskData.joinInType == '2'"
                            v-model="taskData.limitMans"
                            style="width: 100px;"
                            placeholder="人数"
                          />人
                        </el-form-item>
                        <el-form-item label="参与地区限制">
                          <el-radio v-model="taskData.joinInAreaType" label="0">全部</el-radio>
                          <el-radio v-model="taskData.joinInAreaType" label="1">部分</el-radio>
                          <el-button type="text" @click="selectArea">查看设置</el-button>
                        </el-form-item>
                        <el-form-item label="联系信息">
                          <el-radio v-model="taskData.contactInfo" label="0">开启</el-radio>
                          <el-radio v-model="taskData.contactInfo" label="1">关闭</el-radio>
                          <el-button type="text" @click="contactOpen">查看设置</el-button>
                        </el-form-item>
                      </el-form>
                    </el-collapse-item>
                  </el-collapse>
                </el-tab-pane>
                <!--题目设置-->
                <el-tab-pane label="题目设置">
                  <span>答题设置</span>
                  <el-divider />
                  <el-form label-width="100px">
                    <el-form-item label="答题类型">
                      <el-radio v-model="taskData.examType" label="0">随机出题</el-radio>
                      <el-radio v-model="taskData.examType" label="1">固定顺序</el-radio>
                    </el-form-item>
                    <el-form-item label="题库数量">
                      <span>从</span>
                      <el-input
                        v-model="taskData.totalQuestions"
                        style="width: 80px;"
                        @blur="totalQuestionsChange"
                      />
                      <span>道题中随机抽取</span>
                      <el-input
                        v-model="taskData.examQuestions"
                        style="width: 80px;"
                      />
                      <span>道题目</span>
                    </el-form-item>
                    <el-form-item label="答题分数">
                      <span>每道题目</span>
                      <el-input
                        v-model="taskData.questionPoints"
                        style="width: 80px;"
                      /><span>分</span>,<span>共{{ taskData.questionPoints * taskData.examQuestions }}分</span>
                    </el-form-item>
                    <el-form-item label="答题时间">
                      <el-radio v-model="taskData.answerTimeType" label="0">不限</el-radio>
                      <el-radio v-model="taskData.answerTimeType" label="1">总时间限制
                        <span
                          v-if="taskData.answerTimeType == '1'"
                        ><el-input
                          v-model="limitation1"
                          style="width: 80px"
                        />秒</span></el-radio>
                      <el-radio v-model="taskData.answerTimeType" label="2">每道题目<span v-if="taskData.answerTimeType == '2'"><el-input v-model="limitation2" style="width: 80px;" /><span>秒</span>,<span>共{{ taskData.examQuestions * limitation2 }}秒</span></span></el-radio>
                    </el-form-item>
                    <el-form-item label="判断对错时机">
                      <el-radio v-model="taskData.judgeType" label="0">选择时判断</el-radio>
                      <el-radio v-model="taskData.judgeType" label="1">提交时判断</el-radio>
                    </el-form-item>
                    <el-form-item label="正确答案">
                      <el-radio v-model="radio10" label="1">显示</el-radio>
                      <el-radio v-model="radio10" label="2">隐藏</el-radio>
                    </el-form-item>
                    <el-form-item label="答案解析">
                      <el-radio v-model="radio11" label="1">显示</el-radio>
                      <el-radio v-model="radio11" label="2">隐藏</el-radio>
                    </el-form-item>
                  </el-form>
                  <!--TODO 题目编辑-->
                  <span>题目编辑</span>
                  <el-divider />
                  <cardList ref="card-list" :question-count="+taskData.totalQuestions" />
                </el-tab-pane>
                <el-tab-pane label="派奖方式">
                  <span>抽奖限制</span>
                  <el-divider />
                  <el-form label-width="100px">
                    <el-form-item label="抽奖门槛">
                      <span>活动成绩达到</span><el-input style="width: 80px;" /><span>分,即为挑战成功可抽奖</span>
                    </el-form-item>
                    <el-form-item label="总参与机会">
                      <el-radio v-model="taskData.totalAwardsTimesType" label="0">不限</el-radio>
                      <el-radio v-model="taskData.totalAwardsTimesType" label="1">限制<el-input v-if="taskData.totalAwardsTimesType = '1'" v-model="taskData.totalAwardsTimes" style="width: 80px;" /> 次</el-radio>
                    </el-form-item>
                    <el-form-item label="每日参与机会">
                      <span>每人每日有</span><el-input v-model="taskData.everyDateAwardsTimes" style="width: 80px;" /><span>次机会</span>
                    </el-form-item>
                    <el-form-item label="总抽奖机会">
                      <el-radio v-model="taskData.totalJoinTimesType" label="0">不限</el-radio>
                      <el-radio v-model="taskData.totalJoinTimesType" label="1">限制<el-input v-if="taskData.totalJoinTimesType == '2'" v-model="taskData.totalJoinTimes" style="width: 80px;" /> 次</el-radio>
                    </el-form-item>
                    <el-form-item label="每日抽奖机会">
                      <span>每人每日有</span><el-input v-model="taskData.everyDateJoinTimes" style="width: 80px;" /><span>次抽奖机会</span>
                    </el-form-item>
                  </el-form>
                  <span>中奖率</span>
                  <el-divider />
                  <el-form label-width="100px">
                    <el-form-item label="每人中奖次数">
                      <span>每人最多可中奖</span><el-input v-model="taskData.everyoneCanAwardsTimes" style="width: 80px;" /><span>次</span>
                    </el-form-item>
                    <el-form-item label="每日中奖次数">
                      <el-radio v-model="taskData.everyoneEverydateAwardsType" label="0">不限</el-radio>
                      <el-radio v-model="taskData.everyoneEverydateAwardsType" label="1">限制<el-input v-if="taskData.everyoneEverydateAwardsType == '2'" v-model="taskData.everyoneEverydateAwardsTimes" style="width: 80px;" /> 次</el-radio>
                    </el-form-item>
                    <el-form-item label="抽奖模式">
                      <!--<el-radio v-model="radio15" label="1">按人流量发放</el-radio>-->
                      <el-radio v-model="taskData.awardType" label="0">时间均匀发放</el-radio>
                    </el-form-item>
                    <el-form-item label="总中奖率">
                      <el-input style="width: 80px;" /><span>%</span>
                    </el-form-item>
                    <el-form-item label="奖品分期投放">
                      <el-radio v-model="radio16" label="1">关闭</el-radio>
                      <el-radio v-model="radio16" label="2">12小时</el-radio>
                      <el-radio v-model="radio16" label="3">24小时</el-radio>
                      <el-radio v-model="radio16" label="4">48小时</el-radio>
                    </el-form-item>
                    <el-form-item label="主办单位">
                      <el-input v-model="taskData.organizer" />
                    </el-form-item>
                    <el-form-item label="主板单位网站链接">
                      <el-input v-model="taskData.organizerWebsite" />
                    </el-form-item>
                  </el-form>
                </el-tab-pane>
                <el-tab-pane label="奖项设置">
                  <span>请设置需要派发的奖项</span><i class="el-icon-circle-plus-outline" style="margin-left: 10px;font-size: 20px;" @click="addTab" />
                  <div class="div-box">
                    <el-tabs v-model="editableTabsValue" type="border-card" closable @tab-remove="removeTab">
                      <el-tab-pane v-for="(item) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
                        <span>基本选项-{{ item.title }}</span>
                        <el-divider />
                        <el-form label-width="100px">
                          <el-form-item label="奖项等级">
                            <el-input v-model="item.awardsLevel" />
                          </el-form-item>
                          <el-form-item label="奖项类型">
                            <el-select v-model="item.awardsSeq" placeholder="请选择">
                              <el-option label="微信现金红包" value="0" />
                              <el-option label="实物礼品" value="1" />
                            </el-select>
                          </el-form-item>
                          <el-form-item label="奖项名称">
                            <el-input v-model="item.awardName" />
                          </el-form-item>
                          <el-form-item label="奖项数量">
                            <el-input v-model="item.awardNums" />
                          </el-form-item>
                          <el-form-item label="重复中奖限制">
                            <el-radio v-model="radio17" label="1">不限</el-radio>
                            <el-radio v-model="radio17" label="2">开启</el-radio>
                            <span v-if="radio17 == '2'">每人最多抽中该奖项<el-input style="width: 80px;" />次</span>
                          </el-form-item>
                          <el-form-item v-if="item.awardsSeq == '0'" label="红包金额">
                            <el-radio v-model="item.moneyType" label="0">固定</el-radio>
                            <el-radio v-model="item.moneyType" label="1">随机</el-radio>
                            <span v-if="item.moneyType == '0'">每个金额：<el-input v-model="item.singleAvgMoney" style="width:80px" />元</span>
                            <span v-if="item.moneyType == '1'">平均金额：<el-input v-model="item.singleAvgMoney" style="width:80px" />元</span>
                            <br>
                            <span v-if="item.moneyType == '1'">浮动范围:最低可抽到<el-input v-model="item.minMoney" style="width:80px" />元红包，最高可抽到<e-input v-model="item.maxMoney" style="width:80px" /></span>

                          </el-form-item>
                          <el-form-item label="奖品介绍">
                            <el-radio v-model="radio19" label="1">不限</el-radio>
                            <el-radio v-model="radio19" label="2">开启</el-radio>
                            <span>文字介绍</span><el-input type="textarea" />
                          </el-form-item>
                        </el-form>
                        <span>兑奖选项-{{ item.title }}</span>
                        <el-divider />
                        <el-form label-width="100px">
                          <el-form-item v-if="selectValue == '1'" label="支付后兑奖">
                            <el-radio v-model="radio20" label="1">关闭</el-radio>
                            <el-radio v-model="radio20" label="2">开启</el-radio>
                          </el-form-item>
                          <el-form-item v-if="selectValue == '1'" label="兑奖方式">
                            <el-radio v-model="item.giftRecieveType" label="0">上门自取</el-radio>
                            <el-radio v-model="item.giftRecieveType" label="1">邮寄</el-radio>
                          </el-form-item>
                          <el-form-item v-if="radio21 == '2'" label="操作提示">
                            <el-input />
                          </el-form-item>
                          <el-form-item v-if="item.giftRecieveType == '0'" label="兑奖地址">
                            <el-input v-model="item.giftRecieveAddress" />
                          </el-form-item>
                          <el-form-item label="兑奖期限">
                            <el-row>
                              <el-radio v-model="radio22" label="1">固定日期</el-radio>
                              <!--<el-radio v-model="radio22" label="2">固定时长</el-radio>-->
                            </el-row>
                            <el-row v-if="radio22 == '1'">
                              <el-col :span="11">
                                <el-date-picker v-model="item.startRecieveAwards" type="date" placeholder="选择日期" style="width: 100%;" />
                              </el-col>
                              <el-col class="line" :span="2">至</el-col>
                              <el-col :span="11">
                                <el-date-picker v-model="item.endRecieveAwards" type="date" placeholder="选择日期" style="width: 100%;" />
                              </el-col>
                            </el-row>
                            <el-row v-if="radio22 == '2'">
                              <span>领取后<el-input />生效，有效天数<el-input />天</span>
                            </el-row>
                          </el-form-item>
                        </el-form>
                      </el-tab-pane>
                    </el-tabs>
                  </div>
                </el-tab-pane>
              </el-tabs>
            </div>
          </el-form>
          <!--选择地区弹窗-->
          <el-dialog width="50%" title="选择地区" :visible.sync="innerVisible" append-to-body>
            <el-transfer v-model="areaValue" :data="areaData" />
          </el-dialog>
          <!--联系方式弹窗-->
          <el-dialog width="50%" title="联系方式" :visible.sync="contactVisible" append-to-body>
            <el-form>
              <el-form-item label="联系信息">
                <el-radio v-model="taskData.contactInfoInput" label="0">参与前填写</el-radio>
                <el-radio v-model="taskData.contactInfoInput" label="1">参与后填写</el-radio>
              </el-form-item>
              <el-form-item label="用户修改限制">
                <el-radio v-model="taskData.contactInfoModify" label="0">可修改</el-radio>
                <el-radio v-model="taskData.contactInfoModify" label="1">不可修改</el-radio>
              </el-form-item>
              <el-divider />
              <el-form-item label="需填信息">
                <el-checkbox v-model="taskData.needInfo.name">姓名</el-checkbox>
                <el-checkbox v-model="taskData.needInfo.phone">联系电话</el-checkbox>
                <el-checkbox v-model="taskData.needInfo.address">联系地址</el-checkbox>
              </el-form-item>
              <el-form-item label="电话短信验证">
                <el-radio v-model="taskData.contactInfoSms" label="0">开启</el-radio>
                <el-radio v-model="taskData.contactInfoSms" label="1">不开启</el-radio>
              </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
              <el-button @click="contactVisible = false">取 消</el-button>
              <el-button type="primary" @click="contactVisible = false">确 定</el-button>
            </span>
          </el-dialog>
        </el-col>
        <!--右侧设置结束-->
      </el-row>
    </el-dialog>
    <el-dialog title="用户记录" :visible.sync="userRecordVisible" width="100%" height="100%" :before-close="handleClose" overflow-y="scroll">
      <el-row :gutter="10">
        <el-col :span="4">
          <el-select v-model="queryValue" placeholder="请选择" style="width:50%">
            <el-option v-for="item in queryOptions" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
          <el-input placeholder="请输入内容" style="width:50%" />
        </el-col>
        <el-col :span="12">
          <el-radio-group v-model="radio22">
            <el-radio-button label="今天" />
            <el-radio-button label="昨天" />
            <el-radio-button label="最近7天" />
            <el-radio-button label="最近30天" />
            <el-radio-button label="活动期间" />
          </el-radio-group>
          <el-date-picker v-model="value6" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="margin-left: 10px;" />
        </el-col>
        <el-col :span="8">
          <el-button type="primary">批量填写物流单</el-button>
          <el-button type="primary">导出名单</el-button>
          <el-button type="primary">刷新</el-button>
        </el-col>
      </el-row>
      <el-row style="margin-top:10px">
        <el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" />
          <el-table-column prop="userCode" label="用户编号" />
          <el-table-column prop="winUser" label="中奖用户" />
          <el-table-column prop="level" label="奖项等级" sortable />
          <el-table-column prop="prize" label="奖品" />
          <el-table-column prop="winTime" label="中奖时间" />
          <el-table-column prop="cardStatus" label="卡券状态" sortable />
          <el-table-column prop="consignee" label="收货人(邮寄)" />
          <el-table-column prop="receivingPhone" label="收货人电话(邮寄)" />
          <el-table-column prop="name" label="姓名" />
          <el-table-column prop="phone" label="联系电话" />
          <el-table-column prop="address" label="联系地址" />
          <el-table-column label="操作" />
        </el-table>
      </el-row>
    </el-dialog>
  </div>
</template>
<script>
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
import cardList from '@/components/CardList/cardList.vue'
import { saveTask } from '@/api/system/buzTask'

export default {
  name: 'App',
  components: {
    cardList
  },
  data() {
    // 测试穿梭框数据
    const generateData = _ => {
      const data = []
      for (let i = 1; i <= 15; i++) {
        data.push({
          key: i,
          label: `备选项 ${i}`,
          disabled: i % 4 === 0
        })
      }
      return data
    }
    return {
      taskData: {
        'status': '0',
        'joinInType': '0',
        'joinInAreaType': '0',
        'contactInfo': '0',
        'contactInfoInput': '0',
        'contactInfoModify': '0',
        'contactInfoSms': '0',
        'examQuestions': 0,
        'questionPoints': 0,
        'answerTimeType': '0',
        'judgeType': '0',
        'totalAwardsTimesType': '0',
        'totalJoinTimesType': '0',
        'everyoneEverydateAwardsType': '0',
        'awardType': '0',
        'examType': '0',
        'examPoints': 0,
        'needInfo': {
          'name': '',
          'phone': '',
          'address': ''
        }

      },
      limitation1: 0,
      limitation2: 0,
      tasktime: '',
      activeName: 'all',
      taskAddVisible: false,
      innerVisible: false,
      tabPosition: 'left',
      editor: ClassicEditor,
      editorData: '<p>内容</p>',
      editorConfig: {
        // The configuration of the editor.
      },
      activeNames: ['1'],
      areaData: generateData(),
      areaValue: [1, 4],
      contactVisible: false,
      radio4: '1',
      radio5: '1',
      checkedName: false,
      checkedPhone: false,
      checkedAddress: false,
      radio6: '1',
      radio7: '1',
      radio8: '1',
      radio9: '1',
      radio10: '1',
      radio11: '1',
      radio12: '1',
      radio13: '1',
      radio14: '1',
      radio15: '1',
      radio16: '1',
      radio17: '1',
      radio18: '1',
      radio19: '1',
      radio20: '1',
      radio21: '1',
      radio22: '1',
      editableTabsValue: '2',
      editableTabs: [{
        title: '奖项1',
        name: '1',
        moneyType: '0',
        giftRecieveType: '0'
      }, {
        title: '奖项2',
        name: '2',
        moneyType: '0',
        giftRecieveType: '0'
      }],
      tabIndex: 2,
      selectValue: '1',
      userRecordVisible: false,
      queryOptions: [
        {
          value: 'nickName',
          label: '用户昵称'
        }
      ],
      queryValue: 'nickName',
      tableData: [],
      multipleSelection: [],
      value6: ''
    }
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event)
    },
    openAdd() {
      this.taskAddVisible = true
    },
    selectArea() {
      this.innerVisible = true
    },
    contactOpen() {
      this.contactVisible = true
    },
    addTab() {
      const newTabName = ++this.tabIndex + ''
      this.editableTabs.push({
        title: '奖项' + newTabName,
        name: newTabName,
        moneyType: '0',
        giftRecieveType: '0'
      })
      this.editableTabsValue = newTabName
    },
    removeTab(targetName) {
      const tabs = this.editableTabs
      let activeName = this.editableTabsValue
      if (activeName === targetName) {
        tabs.forEach((tab, index) => {
          if (tab.name === targetName) {
            const nextTab = tabs[index + 1] || tabs[index - 1]
            if (nextTab) {
              activeName = nextTab.name
            }
          }
        })
      }
      this.editableTabsValue = activeName
      this.editableTabs = tabs.filter(tab => tab.name !== targetName)
    },
    handleCommand(command) {
      switch (command) {
        case 'userRecord':
          this.openUserRecord()
          break
        default:
          this.$message({
            type: 'info',
            message: '已取消'
          })
          break
      }
    },
    openUserRecord() {
      this.userRecordVisible = true
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    addTask() {
      console.log(this.tasktime)
      // 获取开始时间
      if (this.tasktime) this.taskData.startTime = this.tasktime[0]
      // 获取结束时间
      if (this.tasktime) this.taskData.endTime = this.tasktime[1]
      // 获取活动说明
      if (this.editorData) this.taskData.memo = this.editorData
      // 计算总分
      if (this.taskData.questionPoints > 0 && this.taskData.examQuestions > 0) {
        console.log(this.taskData.questionPoints, this.taskData.examQuestions)
        this.taskData.examPoints = (this.taskData.questionPoints * this.taskData.examQuestions)
      }
      // 获取时间限制
      switch (this.taskData.answerTimeType) {
        case '1': this.taskData.limitTimes = this.limitation1
          break
        case '2': this.taskData.limitTimes = this.limitation2
          break
        default:
      }
      /* 获取题目数据*/
      const questionData = this.$refs['card-list'].getValue()

      this.taskData.needInfo = JSON.stringify(this.taskData.needInfo)

      const alldata = {
        buzTask: this.taskData,
        buzTaskQuestions: questionData,
        buzTaskAwards: this.editableTabs

      }
      // this.taskData.questionList = questionData
      //  this.taskData.buzTaskAwards = this.editableTabs
      /* 获取奖项数据*/
      // console.log(this.editableTabs)

      console.log(alldata)
      saveTask(alldata).then(res => {
        this.$message({
          type: 'info',
          message: res
        })
      })
      console.log('-------save Task------')
    },
    totalQuestionsChange() {
      // 监听题库数量修改事件
      console.log(this.taskData.totalQuestions)
      this.$refs['card-list'].createQuestions()
    }

  }
}
</script>
<style>
.div-box {
  margin: 20px;
}

.el-card__body {
  padding: 0px;
  height: 100%;
  vertical-align: middle;
}

.box-card {
  width: 100%;
  height: 280px;
  margin-bottom: 20px;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both
}

.image {
  width: 150px;
  height: 60px;
}

.bottom {
  margin-top: 12px;
  text-align: center;
}

.phoneWarp {
  width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.phoneBox {
  height: 667px;
  width: 495px;
  z-index: 100;
  margin: 60px auto;
  position: relative;
}

.phone {
  width: 375px;
  height: 754px;
  background: #e9e7e7;
  float: left;
  box-shadow: 0 0 6px rgba(0, 0, 0, .1);
}

.wxTitle {
  height: 64px;
  width: 375px;
  position: relative;
  background: url('../../../assets/images/wxTitle.png') no-repeat;
}

.wxTitle span {
  position: absolute;
  top: 80%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #050404;
}
</style>
